#include <bits/stdc++.h>
using namespace std;

using ll = long long int;
const int N = 1e5 + 10;
int nums[N];
int n;
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> nums[i];
    int ret = 0;
    int index = 0;
    if (n == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    while (index < n)
    {
        if (index == n - 1)
        {
            ret++;

            break;
        }

        if (nums[index] < nums[index + 1])
        {
            ret++;
            while (index < n - 1 && nums[index] < nums[index + 1])
                index++;
        }
        else if (nums[index] > nums[index + 1])
        {
            while (index < n - 1 && nums[index] > nums[index + 1])
                index++;
            ret++;
        }
        else
        {
            while (index < n - 1 && nums[index] == nums[index + 1])
                index++;
        }
        index++;
    }
    cout << ret << endl;
    return 0;
}